package com.easychat.entity.enums;

public enum OpTypeEnum {
    REMOVE(0, "移除群成员"),
    ADD(1, "添加群成员");

    private Integer type;//操作类型
    private String description;//描述

    OpTypeEnum(Integer type, String description) {
        this.type = type;
        this.description = description;
    }

    public Integer getType() {
        return type;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据类型返回对应的枚举对象
     * @param opType 操作类型
     * @return
     */
    public static OpTypeEnum getByType(Integer opType) {
        for (OpTypeEnum typeEnum : OpTypeEnum.values()) {
            if (typeEnum.getType().equals(opType)) {
                return typeEnum;
            }
        }
        return null;
    }
}
